package com.chd.picrotate;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.annotation.Nullable;
import android.support.annotation.RequiresApi;
import android.util.AttributeSet;
import android.widget.ImageView;

import butterknife.BindBitmap;

/**
 * Created by feiyu on 17-7-3.
 */

public class RotateImageView extends android.support.v7.widget.AppCompatImageView {

    public RotateImageView(Context context) {
        super(context);
    }

    public RotateImageView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public RotateImageView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
    }

    public void leftTurn() {
        getImageMatrix().postRotate(-90,getWidth()/2,getHeight()/2);
        invalidate();

    }

    public void rightTurn() {
        getImageMatrix().postRotate(90,getWidth()/2,getHeight()/2);
        invalidate();
    }
}
